package com.findyou.service.impl;

import com.findyou.dao.UserDao;
import com.findyou.pojo.User;
import com.findyou.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Title: UserServiceImpl
 * @Author 贾金博
 * @Package com.findyou.service.impl
 * @Date 2025/6/8 上午10:47
 * @description: 用户逻辑层 实现类
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    /**
     * 根据用户的姓名来查询具体的用户
     * @param username
     * @return
     */
    @Override
    public User findUserByUsername(String username) {
        return userDao.findUserByUsername(username);
    }

    /**
     * 查询全部的用户信息
     * @return
     */
    @Override
    public List<User> findAllUsers() {
        return userDao.findAllUsers();
    }

    /**
     * 插入新的用户
     * @param user
     * @return
     */
    @Override
    public int saveUser(User user) {
        return userDao.insertUser(user);
    }

    /**
     * 插入新的用户
     * @param user
     * @return
     */
    public int addUser(User user) {
        return userDao.insertUser(user);
    }



}
